"""Controller for current students."""

from turbogears import expose, redirect, validate, identity, validators, widgets
from mnemoply.controllers.lookup import TableLookupDataSource
from mnemoply.controllers.Student import StudentController, StudentsInGroupItemTab, AgreementItemTab
from mnemoply.model.field import Student
from mnemoply.model.agreement import StudentAndAgreement, Customer
from mnemoply.controllers.lookup import LookupController, TableCol
from mnemoply.controllers.crud import CRUDController
from mnemoply.utils import LocalMenuItem
from mnemoply._renewed_model.field import Account, StudentNew, Personality
from cherrypy import request


class StudentAndAgreementController(LookupController, CRUDController):
    """Controller for students."""
    model_object = StudentAndAgreement
    lookup_columns = [
        TableCol(name='id', caption=_("ID"),size=4),
        TableCol(name='student', caption=_("Student")),
        TableCol(name='customer', caption=_("Customer")),
        TableCol(name='agreement', caption=_("Agreements")),
        TableCol(name='office', caption=_("Office")),
        TableCol(name='groups', caption=_("Groups")),
        TableCol(name='amount_of_customer', caption=_("Amount of customer"),size=5),
        TableCol(name='amount_of_agreement', caption=_("Amount of agreement")),
        ]
    def __init__(self):
        self.view_fields = []
        self.edit_fields = []
        self.item_tabs = [StudentsInGroupItemTab(), AgreementItemTab()]

        LookupController.__init__(self,
            data_source=TableLookupDataSource('student_and_agreement'),
            columns=self.lookup_columns,
        )
        CRUDController.__init__(self, model_object=self.model_object)
        self.title = _("Student and agreement")
    


exposed = StudentAndAgreementController()
